home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / et / et3_0-a1.lha / et3 / src / BorderItems.C < prev    next >
C/C++ Source or Header  |  1992-06-09  |  2KB  |  114 lines

  1. #ifdef __GNUG__
  2. #pragma implementation
  3. #endif
  4.  
  5. #include "BorderItems.h"
  6.  
  7. #include "Class.h"
  8. #include "String.h"
  9. #include "Look.h"
  10. #include "TextItem.h"
  11. #include "Math.h"
  12.  
  13. //---- Matte -------------------------------------------------------------------
  14.  
  15. NewMetaImpl(Matte,CompositeVObject, (T(border)));
  16.  
  17. Matte::Matte(VObject *in) : CompositeVObject(cIdNone, in, 0)
  18. {
  19.     border= Point(20);
  20. }
  21.  
  22. Matte::Matte(Point b, VObject *in) : CompositeVObject(cIdNone, in, 0)
  23. {
  24.     border= b;
  25. }
  26.  
  27. Matte::Matte(int id, Point b, VObject *in) : CompositeVObject(id, in, 0)
  28. {
  29.     border= b;
  30. }
  31.  
  32. void Matte::SetBorder(Point b)
  33. {
  34.     border= b;
  35. }
  36.  
  37. void Matte::SetOrigin(Point at)
  38. {
  39.     VObject::SetOrigin(at);
  40.     At(0)->SetOrigin(at+border);
  41. }
  42.  
  43. void Matte::SetExtent(Point e)
  44. {
  45.     VObject::SetExtent(e);
  46.     e-= 2*border;
  47.     At(0)->SetExtent(e);
  48. }
  49.  
  50. Metric Matte::GetMinSize()
  51. {
  52.     VObject *inner= At(0);
  53.     Metric m= At(0)->GetMinSize();
  54.     SetFlag(eVObjHFixed, inner->TestFlag(eVObjHFixed));
  55.     SetFlag(eVObjVFixed, inner->TestFlag(eVObjVFixed));
  56.     return m.Expand(border);
  57. }
  58.  
  59. OStream& Matte::PrintOn(OStream &s)
  60. {
  61.     CompositeVObject::PrintOn(s);
  62.     return s << border SP;
  63. }
  64.  
  65. IStream& Matte::ReadFrom(IStream &s)
  66. {
  67.     CompositeVObject::ReadFrom(s);
  68.     return s >> border;
  69. }
  70.  
  71. //---- BorderItem -------------------------------------------------------------------
  72.  
  73. NewMetaImpl0(BorderItem,CompositeVObject);
  74.  
  75. BorderItem::BorderItem(VObject *in) : CompositeVObject(cIdNone, in, 0)
  76. {
  77. }
  78.  
  79. BorderItem::BorderItem(VObject *ti, VObject *in) : CompositeVObject(cIdNone, in, ti, 0)
  80. {
  81. }
  82.  
  83. BorderItem::BorderItem(char *ti, VObject *in)
  84.             : CompositeVObject(cIdNone, in, new TextItem(ti), 0)
  85. {
  86. }
  87.  
  88. void BorderItem::SetOrigin(Point at)
  89. {
  90.     VObject::SetOrigin(at);
  91.     gLook->GroupLayout()->SetOrigin(this, at);
  92. }
  93.  
  94. void BorderItem::SetExtent(Point e)
  95. {
  96.     VObject::SetExtent(e);
  97.     gLook->GroupLayout()->SetExtent(this, e);
  98. }
  99.  
  100. Metric BorderItem::GetMinSize()
  101. {
  102.     Metric m(gLook->GroupLayout()->GetMinSize(this));
  103.     SetFlag(eVObjHFixed, At(0)->TestFlag(eVObjHFixed));
  104.     SetFlag(eVObjVFixed, At(0)->TestFlag(eVObjVFixed));
  105.     return m;
  106. }
  107.  
  108. void BorderItem::Draw(Rectangle r)
  109. {
  110.     CompositeVObject::Draw(r);
  111.     gLook->GroupLayout()->Adorn(this, r, 0);
  112. }
  113.  
  114.